<?php

namespace app\astroapp\controller\v1;

use app\astroapp\controller\AstroAppRemoteAuth;
use app\common\cachemodel\acquired_astro\ZhunleappAstroExercise;

class AcquiredAstro extends AstroAppRemoteAuth
{
    /**
     * @return \think\response\Json
     */
    public function getQids()
    {
        $tid = input('tid/d', 0);

        $data = $tid ? (new ZhunleappAstroExercise())->getQuestionIds($tid) : [];

        return show(config('code.success'), '请求成功', $data);
    }

    public function getQuestionInfo()
    {
        $ids = input('ids/s', '');
        if (empty($ids))
        {
            return show(config('code.success'), '请求成功');
        }
        $idsArr = explode(',', $ids);

        $dataList = (new ZhunleappAstroExercise())->batchGetInfoByIds($idsArr);

        return show(config('code.success'), '请求成功', $dataList ? array_values($dataList) : []);
    }
}